#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<string.h>
#include<stdio.h>
#include<queue>
#include<stack> 
#include<set>
#include<sstream>
#include <utility>
#define lowbit(x) (x&(-x))
#define endl "\n"
using namespace std;
typedef long long ll;
const int N = 200010;
const ll mod = 1e9 + 7;
typedef long long LL;
const LL inf = (LL)4e18;

ll arr[N];

int main()
{
    cin.tie(); std::ios::sync_with_stdio(false);

    int t;
    cin >> t;
    while (t--)
    {
        int n, k;
        cin >> n >> k;
        for (int i = 1; i <= n; i++)
        {
            cin >> arr[i];
        }
        ll l; ll r;
        l = arr[1] - k;
        r = arr[1] + k;
        int add = 0;
        for (int i = 1; i <= n; i++)
        {
            if (arr[i] - k > l)
                l = arr[i] - k;
            if (arr[i] + k < r)
                r = arr[i] + k;
            if (l > r)
            {
                add++;
                l = arr[i] - k;
                r = arr[i] + k;
            }
        }
        cout << add << endl;
    }

    return 0;
}